﻿using Autofac;
using Jinjia.Approve.IService.JJFlow.Approvers;
using Jinjia.Approve.IService.JJFlow.Condition;
using Jinjia.Approve.Service.JJFlow.Approvers;
using Jinjia.Approve.Service.JJFlow.Condition;
using Jinjia.Core;
using Jinjia.Core.SignInterface;

namespace Jinjia.Approve.Service.DI
{
    public class ServiceModule : InjectionModule
    {
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);
            builder.RegisterAssemblyTypes(typeof(ServiceModule).Assembly)
                .InstancePerLifetimeScope()
                .AsImplementedInterfaces()
                .PropertiesAutowired();

            builder.RegisterDynamicProxyService();

            #region IJJCondition

            builder.RegisterType<BcstRequestCondition>().Named<IJJCondition>(nameof(BcstRequestCondition)).InstancePerLifetimeScope();
            builder.RegisterType<FxOrderShopCondition>().Named<IJJCondition>(nameof(FxOrderShopCondition)).InstancePerLifetimeScope();
            builder.RegisterType<FxOrderShopFinancialCondition>().Named<IJJCondition>(nameof(FxOrderShopFinancialCondition)).InstancePerLifetimeScope();
            builder.RegisterType<PaymentDefaultCondition>().Named<IJJCondition>(nameof(PaymentDefaultCondition)).InstancePerLifetimeScope();
            builder.RegisterType<PaymentDepartmentConditions>().Named<IJJCondition>(nameof(PaymentDepartmentConditions)).InstancePerLifetimeScope();
            builder.RegisterType<PaymentStartUserCondition>().Named<IJJCondition>(nameof(PaymentStartUserCondition)).InstancePerLifetimeScope();
            builder.RegisterType<PurchasePrepaymentApplyApproverRealize>().Named<IJJCondition>(nameof(PurchasePrepaymentApplyApproverRealize)).InstancePerLifetimeScope();

            #endregion

            #region IJJApprovers

            builder.RegisterType<CSpplyPiceAproveRealize>().Named<IJJApprovers>(nameof(CSpplyPiceAproveRealize)).InstancePerLifetimeScope();
            builder.RegisterType<Dingding1stLevelApprovers>().Named<IJJApprovers>(nameof(Dingding1stLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<Dingding2ndLevelApprovers>().Named<IJJApprovers>(nameof(Dingding2ndLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<Dingding3ndLevelApprovers>().Named<IJJApprovers>(nameof(Dingding3ndLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<Feishu1StLevelApprovers>().Named<IJJApprovers>(nameof(Feishu1StLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<Feishu2NdLevelApprovers>().Named<IJJApprovers>(nameof(Feishu2NdLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<Feishu3NdLevelApprovers>().Named<IJJApprovers>(nameof(Feishu3NdLevelApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<DingdingApproversByRole>().Named<IJJApprovers>(nameof(DingdingApproversByRole)).InstancePerLifetimeScope();
            builder.RegisterType<FXBlackListCustomersApprover>().Named<IJJApprovers>(nameof(FXBlackListCustomersApprover)).InstancePerLifetimeScope();
            builder.RegisterType<FXPlatformCustomersApprover>().Named<IJJApprovers>(nameof(FXPlatformCustomersApprover)).InstancePerLifetimeScope();
            builder.RegisterType<GoodsSampleTradeApproverRealize>().Named<IJJApprovers>(nameof(GoodsSampleTradeApproverRealize)).InstancePerLifetimeScope();
            builder.RegisterType<OakLogisticsPriceApprover>().Named<IJJApprovers>(nameof(OakLogisticsPriceApprover)).InstancePerLifetimeScope();
            builder.RegisterType<PlannedApproverRealize>().Named<IJJApprovers>(nameof(PlannedApproverRealize)).InstancePerLifetimeScope();
            builder.RegisterType<PromotionApplyApproverRealize>().Named<IJJApprovers>(nameof(PromotionApplyApproverRealize)).InstancePerLifetimeScope();
            builder.RegisterType<PurchaseApproverRealize>().Named<IJJApprovers>(nameof(PurchaseApproverRealize)).InstancePerLifetimeScope();
            builder.RegisterType<UserDimissionHandoverApprover>().Named<IJJApprovers>(nameof(UserDimissionHandoverApprover)).InstancePerLifetimeScope();
            builder.RegisterType<AdSettlementDirectorApproversByHrId>().Named<IJJApprovers>(nameof(AdSettlementDirectorApproversByHrId)).InstancePerLifetimeScope();
            builder.RegisterType<AdAcceptanceApprovers>().Named<IJJApprovers>(nameof(AdAcceptanceApprovers)).InstancePerLifetimeScope();
            builder.RegisterType<CurrencyPurchaseApprovers>().Named<IJJApprovers>(nameof(CurrencyPurchaseApprovers)).InstancePerLifetimeScope();

            #endregion
        }
    }
}